package com.mall.action;

import com.github.pagehelper.PageInfo;
import com.mall.bean.Member;
import com.mall.service.MemberServic;
import com.mall.uitl.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/memberController")
public class MemberController {

    @Autowired
    MemberServic memberServic;
    @RequestMapping("/queryBook")
    public JsonUtil queryMember(Member member, Integer currentPage){
        PageInfo<Member> pageInfo =  memberServic.queryDataByPage(currentPage,5,member);

        JsonUtil jsonUtil = new JsonUtil();
        jsonUtil.setData(pageInfo);

        return jsonUtil;
    }

    @RequestMapping("/updateMember")
    public JsonUtil updateMember(Member member){
        int res = memberServic.update(member);

        JsonUtil jsonUtil = new JsonUtil();

        return jsonUtil;
    }

}
